//
// Created by rebeater on 3/30/21.
//

#include <iostream>
#include "RobotDecode.h"
#include "nav_struct.h"
#include "gflags/gflags.h"
DEFINE_string(adi, "", "adi file");
DEFINE_string(icm, "", "icm20602 file");
DEFINE_string(gps, "", "gnss file");
DEFINE_string(rst, "", "rst file");
DEFINE_string(vel, "", "vel file");
DEFINE_string(stim, "", "stim300 file");
DEFINE_string(ent, "", "event file");
using namespace std;

int main(int argc, char *argv[]) {
  if (argc < 3) {
	return -1;
  }

  google::ParseCommandLineFlags(&argc, &argv, true);
  if (argc > 1) {
	cout << argv[argc - 1] << " is not allowed" << endl;
	return -1;
  }
  if (!FLAGS_adi.empty())
	RobotDecode::convertAdiToTXT(FLAGS_adi.c_str(), (FLAGS_adi + ".imutxt").c_str());
  if (!FLAGS_gps.empty())
	RobotDecode::convertGnssToTXT(FLAGS_gps.c_str(), (FLAGS_gps + ".gpstxt").c_str());
  if (!FLAGS_icm.empty())
	RobotDecode::convertIcmToTXT(FLAGS_icm.c_str(), (FLAGS_icm + ".imutxt").c_str());
  if (!FLAGS_rst.empty())
	RobotDecode::convertRstToNav(FLAGS_rst.c_str(), (FLAGS_rst + ".nav").c_str());
  if (!FLAGS_vel.empty()) {
	RobotDecode::convertVelToTXT(FLAGS_vel.c_str(), (FLAGS_vel + ".veltxt").c_str());
  }
  if (!FLAGS_stim.empty()) {
	RobotDecode::convertStimToTxt(FLAGS_stim.c_str(), (FLAGS_stim + ".imutxt").c_str());
  }
  if (!FLAGS_ent.empty()){
	RobotDecode::convertEntToTxt(FLAGS_ent.c_str(), (FLAGS_ent + ".event").c_str());
  }

  return 0;
}
